package com.woniu.login.exception;

import com.woniu.common.entity.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authc.AuthenticationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandle{
    @ExceptionHandler(IllegalStateException.class)
    public Result noTokenException(IllegalStateException e) {
        System.out.println("发生异常");
        e.printStackTrace();
        return new Result(401, "请重新登录", null);
    }
}
